package guda.house.biz.form.rule;

import guda.house.biz.util.PriceUtil;
import guda.house.dal.dataobject.EstateRuleDO;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;


public class EstateRuleForm {

    @NotNull(message = "不能为空")
    private Long varId;
    @NotNull(message = "不能为空")
    @Pattern(regexp = "[+]?(([1-9]\\d*[.]?)|(0.))(\\d{0,2})?",message = "金额应该是整数,最多2位数的小数")
    private String feeUnit;
    @NotNull(message = "不能为空")
    private Integer ruleStatus;

    @NotNull(message = "不能为空")
    private Long villageId;

    public Long getVillageId() {
        return villageId;
    }

    public void setVillageId(Long villageId) {
        this.villageId = villageId;
    }


    public Long getVarId() {
        return varId;
    }

    public void setVarId(Long varId) {
        this.varId = varId;
    }

    public String getFeeUnit() {
        return feeUnit;
    }

    public void setFeeUnit(String feeUnit) {
        this.feeUnit = feeUnit;
    }

    public Integer getRuleStatus() {
        return ruleStatus;
    }

    public void setRuleStatus(Integer ruleStatus) {
        this.ruleStatus = ruleStatus;
    }

    public EstateRuleDO toDO() {
        EstateRuleDO estateRuleDO = new EstateRuleDO();
        estateRuleDO.setVarId(varId);
        estateRuleDO.setFeeUnit(PriceUtil.convertPriceYuan(feeUnit));
        estateRuleDO.setRuleStatus(ruleStatus);
        estateRuleDO.setVillageId(villageId);
        return estateRuleDO;
    }

}
